import { Component, OnInit } from "@angular/core";
import {
  Router,
  ActivatedRoute,
  ActivatedRouteSnapshot,
  RouterState,
  RouterStateSnapshot
} from "@angular/router";
import { SignInService } from "./sign-in.service";

@Component({
  selector: "app-sign-in",
  templateUrl: "./sign-in.component.html",
  styleUrls: ["./sign-in.component.scss"]
})
export class SignInComponent implements OnInit {
  public user: any = {};
  public error: Error;

  constructor(
    private router: Router,
    private activedRoute: ActivatedRoute,
    private signInService: SignInService
  ) {}

  ngOnInit(): void {
    let activedRouteSnapshot: ActivatedRouteSnapshot = this.activedRoute
      .snapshot;
    let routerState: RouterState = this.router.routerState;
    let routerStateSnapshot: RouterStateSnapshot = routerState.snapshot;
  }

  public retrievePwd(): void {}

  public doLogin(): void {
    this.signInService.login();
  }

  public doLogout(): void {
    this.signInService.logout();
    this.router.navigateByUrl("home");
  }
}
